class Profile < ActiveRecord::Base
  belongs_to :user
  has_many   :walls
  
  validates_uniqueness_of   :user_id
  validates_presence_of     :user_id
  validates_numericality_of :user_id, :allow_nil => false
  
  def validate
    errors.add_to_base("User must exist") if !User.find_by_id(self.user_id)
  end
  
  def file=(filePath)
    # TODO: Resize and save images
  end
  
  def file
    
  end
  
  def before_save
    self.last_change = Time.now
  end
end
